﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleExpression
{
    public abstract class DatabaseProvider : IDatabaseProvider
    {
        public abstract string IdentifierDelimiterOpen { get; }
        
        public abstract string IdentifierDelimiterClose { get; }

        public string Encode(object identifier)
        {
			if (identifier.GetType() == typeof(string))
			{
				switch ((string)identifier)
				{
					case "<>":
						identifier = "ne";
						break;
					case ">":
						identifier = "gt";
						break;
					case "<":
						identifier = "lt";
						break;
				}
			}
            return string.Format("{0}{1}{2}", IdentifierDelimiterOpen, identifier, IdentifierDelimiterClose);
        }
    }
}
